import babel from 'rollup-plugin-babel';
import resolve from '@rollup/plugin-node-resolve';
import commonjs from '@rollup/plugin-commonjs';
import typescript from '@rollup/plugin-typescript';
import {terser} from 'rollup-plugin-terser';
import postcss from 'rollup-plugin-postcss';
export default {
    input:'./src/index.js',//打包的输入文件，类似于webpack entry
    output:{//webpack output
        file:'./dist/bundle.js',
        format:'iife',//6种输出格式 amd/es/iife/umd/cjs/system
        name:'calculator',//输出格式为iife或umd的时候必须提供，将会为了一个全局变量持在window下
        globals:{
            lodash:'_'//告诉 rollup,lodash这个模块不要打包了，要想取值 从全局变量_上取就可以了
        }
    },
    plugins:[
         babel({//webpack module rules { exclude://}
            exclude:/node_modules/
        }),
        resolve(),
        commonjs(),
        typescript(),
        terser(),
        postcss(),
    ],
    //webpack external:{lodash:'_'}
    external:['lodash']
}